package models.entities;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Deprecated
public class UserEntity implements Serializable {
    public String email = "";
    public String password = "";
    public int id;
    public String sessionId;
    public String name = "";
    public String phoneNumber = "";
    public String address = "";
    public List<String> roles;
    public Date registerDate;

    public boolean getIsAdmin() {
        return isInRole("admin");
    }
    public boolean isInRole(String role) {
        return roles != null && roles.contains(role);
    }
    public UserEntity(String email, String password, String sessionId) {
        this(sessionId);
        this.email = email;
        this.password = password;
    }

    public UserEntity(String sessionId) {
        this();
        this.sessionId = sessionId;
    }

    public UserEntity() {
        roles = new ArrayList<String>();
    }



    public void setRoles(List<String> userRoles) {
        roles = userRoles;
    }

}
